#ifndef YOOHOO_XDATA_XDATAFIELD_H
#define YOOHOO_XDATA_XDATAFIELD_H

#include "xdata/export.h"
#include "xdata/xdataoption.h"
#include "xmppcore/protocoltranslator.h"

#include <QtCore/QList>

namespace yoohoo_xdata {

using namespace yoohoo_xmppcore;

class YOOHOO_XDATA_EXPORT XDataField : public ProtocolTranslator {
public:
	enum FieldType {
		BOOLEAN,
		FIXED,
		HIDDEN,
		JID_MULTI,
		JID_SINGLE,
		LIST_MULTI,
		LIST_SINGLE,
		TEXT_MULTI,
		TEXT_PRIVATE,
		TEXT_SINGLE
	};
	XDataField(XDataField::FieldType type = XDataField::TEXT_SINGLE);
	void setDesc(QString desc);
	QString desc();
	void setRequired(bool required);
	bool isRequired();
	void setValues(QList<QString> values);
	QList<QString>& values();
	void setType(XDataField::FieldType type);
	XDataField::FieldType type();
	QString typeString();
	void setOptions(QList<XDataOption> options);
	QList<XDataOption>& options();
	void setLabel(QString label);
	QString label();
	void setVar(QString var);
	QString var();

	virtual QString toXml();

protected:
	QString _desc;
	bool _required;
	QList<QString> _values;
	FieldType _type;
	QString _name;
	QString _label;
	QList<XDataOption> _options;
	QString _var;
};

}

#endif
